<?php
if($this->ma == 2){
    echo '<script language="javascript" type="text/javascript">alert("用户仓库号、商品名称、商品仓库条形码、商品重量不能为空！");</script>';
}else if($this->ma == 1){
    echo '<script language="javascript" type="text/javascript">alert("商品修改成功！");</script>';
}else if($this->ma == 3){
    echo '<script language="javascript" type="text/javascript">alert("该商品不存在！");</script>';
}
?>
<script type="text/javascript" src="/js/swfupload/swfupload.js"></script>
<script type="text/javascript" src="/js/swfupload/plugins/swfupload.queue.js"></script>
<script src='/js/swfupload/fileprogress.js'></script>
<script src='/js/swfupload/handlers.js'></script>
<div class="admin_nrtop">
    <div class="wupintopleft">
        <div class="wupincz">
            <div class="nui-toolbar-item">
                <div class="nui-btn ">
                    <a href="/admini/managestore/index" class="nui-btn-text"><span>&lt;&lt;</span>返回</a>
                </div>
            </div>                    
            <div class="nui-toolbar-item">
                <div class="nui-btn ">
                    <a href="javascript:void();" id="editimg" name="editimg" class="nui-btn-text">修改信息</a>
                </div>
                <div class="nui-btn ">
                    <a href="javascript:void();" id="printBarCode" class="nui-btn-text">打印编号</a>
                </div>
                <div class="nui-btn ">
                    <a href="/admini/returngoods/exchange/idlist/<?php echo $this->storedetail->id.","; ?>/type/<?php echo Application_Model_ReturnGoods::TYPE_Return;?>" class="nui-btn-text">退货</a>
                </div>
                <div class="nui-btn ">
                    <a href="/admini/returngoods/exchange/idlist/<?php echo $this->storedetail->id.","; ?>/type/<?php echo Application_Model_ReturnGoods::TYPE_Change?>" class="nui-btn-text">换货</a>
                </div>
                <div class="nui-btn ">
                    <a href="javascript:void();" id="delstoreitem" class="nui-btn-text">删除</a>
                </div>
            </div>     
        </div>
        <div class="wupingrinfo">
            <p>物品编号：<?php echo $this->storedetail->barcode;?><span>|</span>用户：
                <a href="/admini/manageuser/userdetail/id/<?php echo $this->storedetail->userid;?>">
                <?php if($this->storedetail->userinfo) echo $this->storedetail->userinfo->nikename; else echo ''; ?></a>
                <span>|</span>
                仓库号：<a href="/admini/manageuser/userdetail/id/<?php echo $this->storedetail->userid;?>"><?php echo $this->storedetail->bystoreno->storeno;?></a><span>|</span>
                入库时间：<?php echo $this->storedetail->dateInStore;?><span>|</span>
                <?php  $time = date('Y-m-d', strtotime('- ' . 6 . ' month'));?>
                <?php if($this->storedetail->isdelete!=1 && $this->storedetail->dateInStore>$time): ?>
                    提交入库：<?php echo $this->storedetail->operatedate?$this->storedetail->operatedate:'暂无';?><span>|</span>
                <?php elseif($this->storedetail->isdelete==1): ?>
                    <?php if($this->storedetail->operate==1){echo '后台丢弃';}elseif($this->storedetail->operate==2){echo '用户丢弃';}else{echo '丢弃时间';} ?>：<?php echo $this->storedetail->operatedate?$this->storedetail->operatedate:'暂无';?><span>|</span>
                <?php elseif($this->storedetail->isdelete!=1 && $this->storedetail->dateOver<date('Y-m-d H:i:s',time())): ?>
                    过期时间：<?php echo $this->storedetail->dateOver; ?><span>|</span>
                <?php endif; ?>
                出库时间：<?php echo $this->storedetail->dateOut?$this->storedetail->dateOut:"暂无";?></p>
        </div>
    </div>
    <div class="wupintopright">
        <p>用户ID：<?php echo $this->storedetail->userid;?><span>|</span>入库员：<?php echo $this->storedetail->operateName?$this->storedetail->operateName:"无"; ?></p>
    </div>
    <div style="clear:both"></div>
</div>
<div class="wupininfo" id="wupininfo">
        <div class="wupinpic">
        <a href="<?= $this->cdn ?><?= !is_int(strpos('big',$this->storedetail->imageFile))?('/big'.$this->storedetail->imageFile):($this->storedetail->imageFile) ?>"  target="_blank">
        <img src="<?= $this->cdn ?><?= !is_int(strpos('big',$this->storedetail->imageFile))?('/big'.$this->storedetail->imageFile):($this->storedetail->imageFile) ?>" style="vertical-align:middle;"/></a>
    </div>
    <div class="wupincanshu">
        <div class="wupinname">
                <div class="wpname">
                <h1><?php echo $this->storedetail->productName;?></h1><span>[库位：<?php echo $this->storedetail->locationNo?$this->storedetail->locationNo:"暂无";?>]</span>
                <?php if($this->storedetail->isdelete == 1){ ?>
                    <span style="color:red;">已丢弃</span>
                <?php } ?>
            </div>
            <?php if($this->storedetail->state == Application_Model_StoreItem::STATUS_Sended){ ?>
            <div class="wpzt">
                <i></i><p>物品内部状态：<?php echo $this->storedetail->InteriorName;?>，运单-<a href="/admini/managewaybill/index/quick/<?php echo $this->storedetail->waybillinfo?$this->storedetail->waybillinfo->billNo:"暂无"; ?>">
                    <?php echo $this->storedetail->waybillinfo?$this->storedetail->waybillinfo->billNo:"暂无"; ?>
                    </a></p>
            </div>
            <?php } ?>
        </div>
        <div class="wpcs">
            <table>
                <tr>
                    <td class="tz2">前台状态：</td>  
                    <td><?php echo $this->storedetail->StatusName; ?></td>
                </tr>
                <tr>
                    <td class="tz2">包裹来源：</td>  
                    <td><?php echo $this->storedetail->intype; ?></td>
                </tr>
                <tr>
                    <td class="tz2">物流公司：</td>  
                    <td><?php
                    if($this->storedetail->LogisticsName){
                        echo $this->storedetail->LogisticsName;
                    }else{
                            $b= (strpos($this->storedetail->orderNo,"["));
                            $c= (strpos($this->storedetail->orderNo,"]"));
                            echo substr($this->storedetail->orderNo,$b+1,$c-1); 
                    }
                         ?><span><?php if($this->storedetail->cnShipFee>0){?>(国内运费到付：<?php echo $this->storedetail->cnShipFee?$this->storedetail->cnShipFee:"无";?>)<?php } ?></span></td>
                </tr>
                <tr>
                        <td class="tz2">物流单号：</td>  
                    <td><?php if($this->storedetail->LogisticsName){
                        echo $this->storedetail->Logistics;
                    }else{
                    $arrorder = explode(']',$this->storedetail->orderNo);echo $arrorder[1];}?></td>
                    
                </tr>
                <tr>
                    <td class="tz2">物品属性：</td>  
                    <td>
                        <?php echo $this->storedetail->ItemTypeName; ?>
                    </td>
                </tr>
                <tr>
                    <td class="tz2">物品净重：</td>  
                    <td><?php echo $this->storedetail->weight/1000;?>kg</td>
                </tr>
                <tr>
                        <td class="tz2">体积重量：</td>  
                    <td><?php echo $this->storedetail->volumeWeight/1000;?>kg<em>(尺寸：<?php echo  $this->storedetail->length.'*'.$this->storedetail->width.'*'.$this->storedetail->height;?>)</em></td>
                </tr>
                <tr>
                    <td class="tz2">可否特殊：</td>  
                    <td><?php echo $this->storedetail->isPack  == 1?"有包装":"无包装";?><i>/</i><?php echo $this->storedetail->canVacuum == 1?"可真空处理":"不可真空处理";?></td>
                </tr>
                <tr >
                    <td class="tz2">用户备注商品名称：</td>  
                    <td style="color:#c00;"><?php echo $this->storedetail->RemarkName?$this->storedetail->RemarkName:"暂无";?></td>
                </tr>
                <tr >
                    <td class="tz2">用户备注：</td>  
                    <td style="color:#c00;"><?php echo $this->storedetail->bystoreno->remark?$this->storedetail->bystoreno->remark:"暂无";?></td>
                </tr>
            </table>
        </div>
    </div>
    <div style="clear:both"></div>
</div>

<?php if($this->storedetail->intype == "代购订单" && $this->storedetail->ProblemInfo){ ?>
<div class="wpdaigou" id="wpdaigou">
    <div class="wph2">
        <h2>代购物品</h2>
    </div>
    <div class="wpqd">
        <table id="buyshopdetail">
            <tr>
                <th class="li40">
                  <div class="wpzsxx">
                      <p><span id="storeid">订单编号：<?php echo $this->storedetail->ProblemInfo->OrderNum;?></span><span id="datecreate">付款时间：<?php echo $this->storedetail->ProblemInfo->datePaid;?></span></p>
                  </div>
                </th>
                <th class="li15">单价</th>
                <th class="li15">数量</th>
                <th class="li30">说明</th>
            </tr>
            <?php foreach ($this->storedetail->ProblemInfo->shipdetail as $key => $val) {?>
            <?php $productd = $val->byproductd;?>
            <tr>
                <td class="li40">
                    <div class="sp_pic"><a href="<?php echo $productd->remoteImage;?>" target="_blank"><img src="<?php echo $productd->remoteImage;?>" /></a></div>
                    <div class="sp_info"><h1><a href="<?php echo $productd->url;?>" target="_blank"><?php echo $val->productName;?></a></h1>
                        <div class="zdy"><span><?php echo $productd->PropertyAlias;?></span></div>
                        <div class="Remarks"><p><?php echo $val->comment;?></p></div>
                    </div>
                </td>
                <td class="li15">￥<?php echo $val->price;?></td>
                <td class="li15"><?php echo $val->quantity;?></td>
                <td class="li30"><?php if($val->status == Application_Model_OrderItem::Status_Refund) { ?>
                                    <span><font color="green">已退款</font></span>
                                <?php } else if ($val->status == Application_Model_OrderItem::Status_Less) { ?>
                                    <span><font color="green">少货</font></span>
                                <?php } else if ($val->status == Application_Model_OrderItem::Status_Error) { ?>
                                    <span><font color="green">发错货</font></span>
                                <?php } else {echo "正常入库";} ?></td>
            </tr>
            <?php } ?>
        </table>
    </div>
</div>
<?php } else if(($this->storedetail->intype == "预报包裹" || $this->storedetail->intype == "上门取件") && $this->storedetail->ProblemInfo){?>
    <div class="wpbeizhu" id="wpbeizhu">
            <div class="wph2">
            <h2>用户清单</h2>
        </div>
        <div class="wpbznr">
            <p><?php echo $this->storedetail->intype == "预报包裹"?$this->storedetail->ProblemInfo->remark:$this->storedetail->ProblemInfo->waresDescribe; ?></p>
        </div>
    </div>
    <div class="wpbeizhu" id="wpbeizhu">
            <div class="wph2">
            <h2>物品清单</h2>
        </div>
        <div class="wpbznr">
            <p><?php echo $this->storedetail->remark; ?></p>
        </div>
    </div>
<?php } else { ?>
    <div class="wpbeizhu" id="wpbeizhu">
            <div class="wph2">
            <h2>物品清单</h2>
        </div>
        <div class="wpbznr">
            <p><?php echo $this->storedetail->remark; ?></p>
        </div>
    </div>
<?php } ?>
<div class="wuphoto" id="wuphoto">
        <div class="wph2">
        <h2>照片展示</h2>
    </div>
    <div class="photolist">
        <ul>
            <?php if($this->storedetail->getImgs()){        foreach ($this->storedetail->getImgs() as $imgVal) { $imgVal->imgurl = str_replace("http://www.uuch.com", "", $imgVal->imgurl);?>
                <li><a href="<?= $this->cdn ?><?= !is_int(strpos('big',$imgVal->imgurl))?('/big'.$imgVal->imgurl):($imgVal->imgurl) ?>"  target="_blank">
        <img src="<?= $this->cdn ?><?= !is_int(strpos('big',$imgVal->imgurl))?('/big'.$imgVal->imgurl):($imgVal->imgurl) ?>" style="vertical-align:middle;"/></a></li>
            <?php } } ?>
        </ul>
    </div>
    <div style="clear:both"></div>
</div>
<style>
    .itemtype li{float: left;width: 70px;margin-left: 10px;}
    #mf{height: 36px;text-align: right;}
</style>
<div id="editdetail" style="display:none;margin-left: 20px;">
    <div >
        <form method="post" action="/admini/managestore/storedetail/id/<?php echo $this->storedetail->id;?>" id="formstore">
            <p>修改仓库商品信息<p><br>
            <table width="95%" border="1" cellpadding="0" cellspacing="0">
                <tr>
                    <td id="mf">所属用户：</td>
                    <td id="nf"><div id="nikename" style="margin-left:10px;"><?php if($this->storedetail->userinfo) echo $this->storedetail->userinfo->nikename; else echo ''; ?></div></td>
                    <td id="mf">仓库号：</td>
                    <td>&nbsp;&nbsp;<input type="text" id="storeno" name="storeno" value="<?php echo $this->storedetail->bystoreno->storeno;?>" /></td>
                    <td rowspan="5" height="250px" width="270px;">
                        <?= $this->formHidden('image', '/pic/wu40.png') ?>
                        <div class="fieldset flash" id="fsUploadProgress">
                            <span class="legend">Upload Queue</span>
                        </div>
                        <div id="divStatus">0 Files Uploaded</div>
                        <div>
                            <span id="stt"></span></br>
                            <input id="btnCancel" type="button" value="Cancel All Uploads" onclick="swfu.cancelQueue();" disabled="disabled" style="margin-left: 2px; font-size: 8pt; height: 29px;" />
                        </div>
                        <div style="position: absolute;margin-left:120px;margin-top:-100px">
                            <image id="pimage" src="/pic/wu40.png" />
                        </div></td>
                </tr>
                <tr>
                    <td id="mf" height="100px;">商品名称：</td>
                    <td colspan="3" valign="middle">&nbsp;&nbsp;<textarea name="productName" id="productName" style=" width: 500px; height: 92px;padding: 10px;">
                        <?php echo $this->storedetail->productName;?></textarea></td>
                </tr>
                <tr>
                    <td id="mf" height="50px">仓库条形码：</td>
                    <td colspan="2" valign="middle">&nbsp;&nbsp;<input type="text" id="barcode" name="barcode" value="<?php echo $this->storedetail->barcode;?>" readOnly/></td>
                    <td><a href="javascript:void(0)" class="anvbotton4" id="editbarcode" style="margin-left:20px;color: #C00;"><span>更改条形码</span></a></td>
                </tr>
                <tr>
                    <td id="mf">状态：</td>
                    <td>前台状态：&nbsp;<select id="status" name="status">
                            <?php foreach ($this->arrStatus as $key => $statusVal) { ?>
                                 <option value="<?php echo $key;?>" <?php echo $this->storedetail->state == $key?"selected":"";?>><?php echo $statusVal; ?></option>
                            <?php }?>
                        </select>
                        &nbsp;&nbsp;&nbsp;&nbsp;
                     后台状态：&nbsp;<select id="interior" name="interior">
                            <?php foreach ($this->arrInterior as $key => $InteriorVal) { ?>
                                 <option value="<?php echo $key;?>" <?php echo $this->storedetail->interior == $key?"selected":"";?>><?php echo $InteriorVal; ?></option>
                            <?php }?>
                        </select>    
                    </td>
                    <td id="mf">国内运费：</td>
                    <td>&nbsp;&nbsp;<input type="text" id="cnShipFee" name="cnShipFee" value="<?php echo $this->storedetail->cnShipFee;?>" /></td>
                </tr>
                <tr>
                    <td id="mf">物流公司：</td>
                    <td>&nbsp;&nbsp;
                        <input type="text" id="Logisticsname" name="Logisticsname" value="<?php if($this->storedetail->LogisticsName){ echo $this->storedetail->LogisticsName;}else{ $b= (strpos($this->storedetail->orderNo,'['));$c= (strpos($this->storedetail->orderNo,']'));echo substr($this->storedetail->orderNo,$b+1,$c-1);}?>" /></td>
                    <td id="mf">物流单号：</td>
                    <td>&nbsp;&nbsp;<input type="text" id="logistics" name="logistics" value="<?php if($this->storedetail->LogisticsName){ echo $this->storedetail->Logistics;}else{ $arrorder = explode(']',$this->storedetail->orderNo);echo $arrorder[1];}?>" /></td>
                </tr>
                <tr>
                    <td id="mf">物品重量：</td>
                    <td>&nbsp;&nbsp;<input type="text" id="weight" name="weight" value="<?php echo $this->storedetail->weight/1000;?>" style="width:120px"/>kg</td>
                    <td id="mf">体积重量类型：</td>
                    <td colspan="2">&nbsp;&nbsp;<select id="bignessType" name="bignessType">
                            <option value="0" <?php echo $this->storedetail->bignessType == 0?"selected":"";?>>普通</option>
                            <option value="1" <?php echo $this->storedetail->bignessType == 1?"selected":"";?>>轻抛</option>
                            <option value="2" <?php echo $this->storedetail->bignessType == 2?"selected":"";?>>抛</option>
                            <option value="3" <?php echo $this->storedetail->bignessType == 3?"selected":"";?>>重抛</option>
                        </select></td>
                </tr>
                <tr>
                    <td id="mf">体积：</td>
                    <td>&nbsp;&nbsp;<input type="text" id="length" value="<?php echo $this->storedetail->length?$this->storedetail->length:0;?>" name="length" style="width:40px" />*
                        <input type="text" value="<?php echo $this->storedetail->width?$this->storedetail->width:0;?>" id="width" name="width" style="width:40px" />*
                        <input type="text" id="height" value="<?php echo $this->storedetail->height?$this->storedetail->height:0;?>" name="height" style="width:40px" /></td>
                    <td id="mf">体积重量：</td>
                    <td colspan="2">&nbsp;&nbsp;<input type="text" id="volumeWeight" value="<?php echo $this->storedetail->volumeWeight?$this->storedetail->volumeWeight/1000:0;?>" name="volumeWeight" />kg</td>
                </tr>
                <tr>
                    <td id="mf">特殊情况：</td>
                    <td colspan="4">
                        &nbsp;&nbsp;<label><input type="checkbox" id="isPack" name="isPack" <?php echo $this->storedetail->isPack  == 1?"checked":"";?>/>&nbsp;是否有包装</label>
                        &nbsp;&nbsp;<label><input type="checkbox" id="canVacuum" name="canVacuum" <?php echo $this->storedetail->canVacuum  == 1?"checked":"";?>/>&nbsp;能否真空处理</label>
                        &nbsp;&nbsp;<label><input type="checkbox" id="isEmbargo" name="isEmbargo" <?php echo $this->storedetail->isEmbargo  == 1?"checked":"";?>/>&nbsp;是否禁运品</label>
                    </td>
                </tr>
                <tr>
                    <td id="mf">类型：</td>
                    <td colspan="4" nowrap>
                        <ul class="itemtype">
                            <?php
                                foreach(Application_Model_StoreItem::getNames() as $key=>$value){ 
                                    $check = "";
                                    if(($this->storedetail->ItemType & $key) == $key){
                                        $check = "checked";
                                    } ?>
                                    <li><label><input type="checkbox" name="itemType[]" id="itemType" value="<?php echo $key;?>" <?php echo $check;?> />&nbsp;<?php echo $value[0];?></label></li>
                            <?php }  ?>
                        </ul>
                    </td>
                </tr>
                <tr>
                    <td id="mf">清单：</td>
                    <td colspan="4" height="85px;">
                        &nbsp;&nbsp;<textarea name="remark" id="remark" style=" width: 600px; height: 70px;"><?php echo $this->storedetail->remark;?></textarea>
                    </td>
                </tr>
                <tr>
                    <td colspan="5" height="55px;">
                        <input type="hidden" id="storeid" name="storeid" value="<?php echo $this->storedetail->id;?>" />
                        <input type="hidden" id="userid" name="userid" value="<?php echo $this->storedetail->userid;?>" />
                        <input type="hidden" id="operate" name="operate" value="editimg" />
                        <a href="javascript:void(0)" class="anvbotton4" id="redetail" style="margin-left:20px;"><span>取消修改</span></a>
                        <a class="anvbotton" href="javascript:void(0)" id="substore" style="margin-left:20px;"><span>确认提交</span></a>
                     </td>
                </tr>
            </table>
        </form>
    </div>
</div>

<div class="wupincz wpdibu" id="wupincz">
    <div class="nui-toolbar-item">
        <div class="nui-btn ">
            <a href="/admini/managestore/index" class="nui-btn-text"><span>&lt;&lt;</span>返回</a>
        </div>
    </div>                    
    <div class="nui-toolbar-item">
        <div class="nui-btn ">
            <a href="javascript:void();" id="editimg2" name="editimg2" class="nui-btn-text">修改信息</a>
        </div>
        <div class="nui-btn ">
            <a href="javascript:void();" id="printBarCode2" class="nui-btn-text">打印编号</a>
        </div>
         <?php if($this->storedetail->isProblem==1){ ?>
<!--        <div class="nui-btn ">
            <a href="javascript:void();" id="disposeProblem" class="nui-btn-text">处理问题</a>
        </div>-->
         <?php } ?>
        <div class="nui-btn ">
            <a href="/admini/returngoods/exchange/idlist/<?php echo $this->storedetail->id; ?>/type/<?php echo Application_Model_ReturnGoods::TYPE_Return;?>" class="nui-btn-text">退货</a>
        </div>
        <div class="nui-btn ">
            <a href="/admini/returngoods/exchange/idlist/<?php echo $this->storedetail->id; ?>/type/<?php echo Application_Model_ReturnGoods::TYPE_Change?>" class="nui-btn-text">换货</a>
        </div>
        <div class="nui-btn ">
            <a href="javascript:void();" id="delstoreitem2" class="nui-btn-text">删除</a>
        </div>
    </div>     
</div>

<div id="printadd" style="width:280px;text-align: center;display:none;">
        <script type="text/javascript" src="/admins/js/jquery/jquery.PrintArea.js"></script>
        <style>
        body{
            -webkit-print-color-adjust: exact;
        }
        </style>
        <div style="width:220px;float:left;margin-bottom: 10px;text-align: left;font-size: 14px;font-family: Microsoft yahei;margin-left:90px;margin-top:10px;"><?php echo $this->storedetail->barcode;?><div id="loginstoreno" style="margin-right:30px;text-align:right;float:right;width:50px;font-size:14px;font-weight:900;"><?php echo $this->storedetail->bystoreno->storeno; ?></div></div>
        <div style='margin-bottom: 10px;width:280px;margin-left: 90px;'><img src="/barcode/barcode.php?codebar=BCGcode128&text=<?php echo $this->storedetail->barcode;?>" id="barcodeimg" alt="barcode" width="180px" height="50px" style="margin-left:2px"/></div>
        <div style='margin-bottom: 5px;width:280px;margin-left: 90px;'>
            <ul class="kwtj">
                <?php if(!$this->location){echo "个人云仓库";}else{foreach($this->location as $val){ ?>
                <li><?php echo $val;?></li>
                <?php }}?>
            </ul>
        </div>
</div>


<script type="text/javascript">
    $('#printBarCode,#printBarCode2').click(function(){
        $('#barcodeimg').load(function(){
            $('div#printadd').printArea();
        });
		//location.reload();
        //$('div#printadd').printArea();
    });
	//$('div#printadd').printArea();
    $("#editimg,#editimg2").live("click",function(){
        $('div#wupininfo').hide();
        $('div#wpbeizhu').hide();
        $('div#wuphoto').hide();
        $('div#wupincz').hide();
        $("div#wpenti").hide();
        $('div#wpdaigou').hide();
        $("div#editdetail").show();
    });            
        
    $('#length,#width,#height').change(function(){
            var length = parseFloat($('#length').val());
            if(typeof(length) === 'NaN')
                length = 0;
            var width = parseFloat($('#width').val());
            if(typeof(width) === 'NaN')
                width = 0;
            var height = parseFloat($('#height').val());
            if(typeof(height) === 'NaN')
                height = 0;

            $('#volumeWeight').val(length*width*height/5000);
            
            var weight = parseFloat($('#weight').val());
            var volumeWeight = parseFloat($('#volumeWeight').val());
            var volumeWeightSelected = parseFloat(volumeWeight/weight);
            
            if(volumeWeightSelected <= 1)
            {
                $("#bignessType").attr("value",'0');
            }
            else if(volumeWeightSelected > 1 && volumeWeightSelected <= 1.3)
            {
                $("#bignessType").attr("value",'1');
            }
            else if(volumeWeightSelected > 1.3 && volumeWeightSelected <= 1.6)
            {
                 $("#bignessType").attr("value",'2');       
            }
            else if(volumeWeightSelected > 1.6)
            {   
                 $("#bignessType").attr("value",'3');
            }  
        });
    $("#refo").click(function(){
        javascript:history.go(-1);
    });
    $("#redetail").click(function(){
        location.href = "/admini/managestore/storedetail/id/<?php echo $this->storedetail->id;?>"; 
    });
    $("#editbarcode").click(function(){
        if(confirm("您确定修改该商品的仓库条形码吗","提示信息")){
            $.ajax({
                type: 'GET',       
                url: '/admini/managestore/generatebarcode',
                success: function(data){
                    if(data.type === 1){
                        $('#barcode').val(data.barcode);
                    }else{
                        alert("该条形码已经存在，请再点击更换条形码");
                    }
                }
            });
        }
    });
    $("#disposeProblem").click(function(){
        if(confirm("您确定该问题包裹处理好了","提示信息")){
            $.ajax({
                type: 'GET',       
                url: "/admini/managestore/disposeproblem/id/<?php echo $this->storedetail->id;?>",
                success: function(data){
                    if(data == 1){
                        $(".contetn_span").attr("style","color:#f60");
                        $(".status_span").show();
                    }else{
                        alert("出现未知错误");
                    }
                }
            });
        }
    });
    $('#storeno').change(function(){
            var storeno = $(this).val();
            $.post('/admini/managestore/userinfo', {'storeno':storeno}, function(data){
                if(!data){
                    alert('没有找到该仓库号对应的用户信息,请检查仓库号是否输入正确');
                    $('#userid').val("");
                    $('#storeno').val("");
                    $('div#nikename').text("");
                    return;
                }
                $('#userid').val(data.userid);
                $('div#nikename').text(data.nikeName);
            }, 'json');
        });
    $("#substore").live("click",function(){
        var storeno = $("#storeno").val();
        var productName = $("#productName").val();
        var barcode = $("#barcode").val();
        var weight = $("#weight").val();
        if(storeno === ""){
            alert("仓库号不能为空");
        }else if(productName === ""){
            alert("商品名不能为空");
        }else if(barcode === ""){
            alert("仓库条形码不能为空");
        }else if(weight === ""){
            alert("商品重量不能为空");
        }else{
            $('#formstore').submit();
        }
    });
    /*$("#exitissue").live("click",function(){
        $("div#ingboy").attr("style","display:block;");
        $("div#printform").attr("style","display:block;");
        $("div#editdetail").attr("style","display:none;");
    });*/    
    $('#delstoreitem,#delstoreitem2').click(function(){
        if(confirm("确定删除？")){
            $.ajax({
                type: 'GET',       
                url: "/admini/managestore/delstoreitembyid/id/<?php echo $this->storedetail->id;?>",
                success: function(data){
                    if(data.type === 1){
                        alert("删除成功!");
                        location.href = "/admini/managestore/index/isdel/1";
                    }else{
                        alert("已出库的包裹不能删除失败!");
                    }
                }
             });
         }
    });
</script>

<script type="text/javascript">
    var swfu;

    window.onload = function() {
        var settings = {
            flash_url : "/js/swfupload/swfupload.swf",
            upload_url: "/admini/ajax/upload",
            post_params: {"PHPSESSID" : ""},
            file_size_limit : "100 MB",
            file_types : "*.jpeg;*.png;*.jpg;*.gif",
            file_types_description : "图片文件",
            file_upload_limit : 100,
            file_queue_limit : 0,
            custom_settings : {
                progressTarget : "fsUploadProgress",
                cancelButtonId : "btnCancel"
            },
            debug: false,

            // Button settings
            button_image_url: "/images/share/button.gif",
            button_width: "65",
            button_height: "29",
            button_placeholder_id: "stt",
            button_text: '<span class="theFont">上传图片</span>',
            button_text_style: ".theFont { font-size: 16; }",
            button_text_left_padding: 12,
            button_text_top_padding: 3,
                
            // The event handler functions are defined in handlers.js
            file_queued_handler : fileQueued,
            file_queue_error_handler : fileQueueError,
            file_dialog_complete_handler : fileDialogComplete,
            upload_start_handler : uploadStart,
            upload_progress_handler : uploadProgress,
            upload_error_handler : uploadError,
            upload_success_handler : function(file,data){
                $('#image').val($.parseJSON(data));
                $('#pimage').attr('src',$('#image').val());
                var progress = new FileProgress(file, this.customSettings.progressTarget);
                progress.setComplete();
                progress.setStatus("Complete.");
                progress.toggleCancel(false);
            },
            //upload_success_handler : uploadSuccess,
            upload_complete_handler : uploadComplete,
            queue_complete_handler : queueComplete  // Queue plugin event
        };

        swfu = new SWFUpload(settings);
    };
</script>


<?php if($this->quickedit == "edit"){?>
    <script type="text/javascript">
        $('div#wupininfo').hide();
        $('div#wpbeizhu').hide();
        $('div#wuphoto').hide();
        $('div#wupincz').hide();
        $("div#wpenti").hide();
        $('div#wpdaigou').hide();
        $("div#editdetail").show();
    </script>
<?php } ?>